package com.spsyry.product.controller;

import com.spsyry.common.core.domain.R;
import com.spsyry.product.domain.Product;
import com.spsyry.product.service.IProductOptsService;
import com.spsyry.product.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/product/opts")
public class ProductOptsController {
    @Autowired
    private IProductOptsService productOptsService;

    @PostMapping("/listAll")
    public R listAll(){
        return productOptsService.listAll();
    }

    @PostMapping("/add")
    public R add(@RequestBody Product product){
        return productOptsService.add(product);
    }
    @GetMapping("/listById/{id}")
    public R getInfo(@PathVariable("id") Long id){
        return productOptsService.listById(id);
    }
    @DeleteMapping("/removeById/{id}")
    public R removeById(@PathVariable("id") Long id){
        return productOptsService.removeById(id);
    }
    @PostMapping("/updateById")
    public R updateById(@RequestBody Product product){
        return productOptsService.updateById(product);
    }
}
